package cn.elwy.osgi.config.util;

import java.io.File;
import java.net.URL;

import org.osgi.framework.Bundle;

/**
 * 获取资源工具类
 * @author huangsq
 * @version 2.0, 2014-01-12
 * @since 2.0, 2014-01-12
 */
public abstract class ResourceUtil {

	private static RcpPathSupport pathSupport = RcpPathSupport.getInstance();

	private ResourceUtil() {
	}

	public static File getInstallHome() {
		return pathSupport.getInstallHome();
	}

	public static URL getInstallURL() {
		return pathSupport.getInstallURL();
	}

	public static void init() {
		pathSupport.init();
	}

	public static String getInstallPath() {
		return pathSupport.getInstallPath();
	}

	public static File getWorkspacePath() {
		return pathSupport.getWorkspacePath();
	}

	public static File getUserDir() {
		return pathSupport.getUserDir();
	}

	public static URL getWorkspaceURL() {
		return pathSupport.getWorkspaceURL();
	}

	public static File getUserHome() {
		return pathSupport.getUserHome();
	}

	public static File getProductPath() {
		return pathSupport.getProductPath();
	}

	public static URL getProductURL() {
		return pathSupport.getProductURL();
	}

	public static File getConfigurationPath() {
		return pathSupport.getConfigurationPath();
	}

	public static File getLogFile() {
		return pathSupport.getLogFile();
	}

	public static File getAppHome() {
		return pathSupport.getAppHome();
	}

	public static String getAppHomePath() {
		return pathSupport.getAppHomePath();
	}

	public static File getStateLocation(Bundle bundle) {
		return pathSupport.getStateLocation(bundle);
	}

	public static URL getAppHomeUrl() {
		return pathSupport.getAppHomeUrl();
	}

	public static URL getResources(String filePath) {
		return pathSupport.getResources(filePath);
	}

	public static File getConfigHome() {
		return pathSupport.getConfigHome();
	}

	public static URL getResources(Class<?> clazz, String filePath) {
		return pathSupport.getResources(clazz, filePath);
	}

	public static String getConfigHomePath() {
		return pathSupport.getConfigHomePath();
	}

	public static URL getConfigHomeUrl() {
		return pathSupport.getConfigHomeUrl();
	}

	public static void setConfigHome(File file) {
		pathSupport.setConfigHome(file);
	}

	public static File getLogHome() {
		return pathSupport.getLogHome();
	}

	public static void setLogHome(File file) {
		pathSupport.setLogHome(file);
	}

	public static File getResourcesFile(String filePath) {
		return pathSupport.getResourcesFile(filePath);
	}

	public static File getTestDir() {
		return pathSupport.getTestDir();
	}

	public static File getResourcesFile(Class<?> clazz, String filePath) {
		return pathSupport.getResourcesFile(clazz, filePath);
	}

	public static void setTestDir(File testDir) {
		pathSupport.setTestDir(testDir);
	}

	public static URL getResource(URL url, String filePath) {
		return pathSupport.getResource(url, filePath);
	}

	public static URL getBundleResource(Class<?> clazz, String filePath) {
		return pathSupport.getBundleResource(clazz, filePath);
	}

	public static File getResource(File dir, String filePath) {
		return pathSupport.getResource(dir, filePath);
	}

	public static URL getBundleResource(String bundleId, String filePath) {
		return pathSupport.getBundleResource(bundleId, filePath);
	}

	public static URL getBundleResource(Bundle bundle, String filePath) {
		return pathSupport.getBundleResource(bundle, filePath);
	}

	public static File getBundleResourceFile(String bundleId, String filePath) {
		return pathSupport.getBundleResourceFile(bundleId, filePath);
	}

	public static File getBundleResourceFile(Class<?> clazz, String filePath) {
		return pathSupport.getBundleResourceFile(clazz, filePath);
	}

	public static String getResourcesPath(String filePath) {
		return pathSupport.getResourcesPath(filePath);
	}

	public static File getBundleResourceFile(Bundle bundle, String filePath) {
		return pathSupport.getBundleResourceFile(bundle, filePath);
	}

	public static String getResourcesPath(Class<?> clazz, String filePath) {
		return pathSupport.getResourcesPath(clazz, filePath);
	}

	public static File toFile(URL url) {
		return pathSupport.toFile(url);
	}

	public static URL toFileURL(URL url) {
		return pathSupport.toFileURL(url);
	}

	public static URL getResource(Class<?> clazz, String filePath) {
		return pathSupport.getResource(clazz, filePath);
	}

	public static String getResourcePath(Class<?> clazz, String filePath) {
		return pathSupport.getResourcePath(clazz, filePath);
	}

	public static String toFilePath(URL url) {
		return pathSupport.toFilePath(url);
	}

	public static String toFilePath(File file) {
		return pathSupport.toFilePath(file);
	}

	public static String toFilePath(File file, boolean isDirectory) {
		return pathSupport.toFilePath(file, isDirectory);
	}

}